import java.util.concurrent.locks.LockSupport;

public class LockSupportPark2 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("子线程开始执行");
                System.out.println("子线程调用park");
                LockSupport.park();
                //System.out.println("子线程被unpark唤醒继续执行");
                System.out.println("子线程结束执行");
            }
        });
        thread.start();

        Thread.sleep(1000);
        System.out.println("主线程开始执行");;
        System.out.println("主线程中调用unpark唤醒子线程");
//        LockSupport.unpark(thread);
        thread.interrupt();
    }
}
